import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import HelloWord from "@/components/HelloWorld.vue";
import "./assets/main.css";
import axios from "axios";
import store from "./store";
import { createPinia } from 'pinia'
// import ElementUI from 'element-ui';//vue3的项目不支持element-ui
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/display.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 全局引入图片验证码组件
import SlideVerify from "vue-monoplasty-slide-verify";

//全局使用vant组件库
import "vant/lib/index.css";
import Vant from "vant";
const pinia = createPinia()

import * as VForm3 from '@/../lib/vform/designer.umd.js'//打包后的低代码文件注入
import '../lib/vform/designer.style.css'


const app = createApp(App); //根组件选项
app.use(SlideVerify);
app.use(ElementPlus)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(Vant);

app.use(router); //整个应用支持路由
app.use(store);
app.use(pinia)
app.component("HelloWord", HelloWord);


//全局注册VForm3，同时注册了v-form-designer、v-form-render等组件
app.use(VForm3)

app.mount("#app"); //挂在组件，该方法接收一个“容器”参数

app.config.errorHandler = (err) => {
  //处理错误
  console.log(err);
};

//全局声明自定义指令
app.directive("loglog", {
  mounted(el, binding) {
    el.style.color = "green";
  },
});

// 全局配置axios请求配置
axios.defaults.baseURL = "请求根路径";
